#include<stdio.h>
#include<string.h>
int main()
{
    char arr[80] = { 0 };
    //gets(arr);
    fgets(arr, 80, stdin);
    int len = strlen(arr);
    char k = 0;
    scanf(" %c", &k);
    int count = 0;
    for (int i = 0; i < len; i++)
    {
        if (arr[i] == k)
            count++;
    }
    printf("%d", count);
    return 0;

}